<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>Paho C++: src/mqtt/client.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="pahologo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">Paho C++
   &#160;<span id="projectnumber">1.0</span>
   </div>
   <div id="projectbrief">The Paho MQTT C++ Client Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('client_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Friends</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">client.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="client_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment">/*******************************************************************************</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * Copyright (c) 2013-2017 Frank Pagliughi &lt;fpagliughi@mindspring.com&gt;</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> * All rights reserved. This program and the accompanying materials</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> * are made available under the terms of the Eclipse Public License v1.0</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> * and Eclipse Distribution License v1.0 which accompany this distribution.</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> * The Eclipse Public License is available at</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> *    http://www.eclipse.org/legal/epl-v10.html</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> * and the Eclipse Distribution License is available at</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> *   http://www.eclipse.org/org/documents/edl-v10.php.</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> * Contributors:</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> *    Frank Pagliughi - initial implementation and documentation</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment"> *******************************************************************************/</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">#ifndef __mqtt_client_h</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define __mqtt_client_h</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="async__client_8h.html">mqtt/async_client.h</a>&quot;</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#include &lt;future&gt;</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="keyword">namespace </span>mqtt {</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;</div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html">   38</a></span>&#160;<span class="keyword">class </span><a class="code" href="classmqtt_1_1client.html">client</a> : <span class="keyword">private</span> <a class="code" href="classmqtt_1_1callback.html">callback</a></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;{</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> std::chrono::minutes DFLT_TIMEOUT;</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    <span class="keyword">static</span> constexpr <span class="keywordtype">int</span> DFLT_QOS = 1;</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    <a class="code" href="classmqtt_1_1async__client.html">async_client</a> cli_;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    std::chrono::milliseconds timeout_;</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;    <a class="code" href="classmqtt_1_1callback.html">callback</a>* userCallback_;</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    std::shared_ptr&lt;T&gt; ptr(<span class="keyword">const</span> T&amp; val) {</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;        <span class="keywordflow">return</span> std::shared_ptr&lt;T&gt;(<span class="keyword">const_cast&lt;</span>T*<span class="keyword">&gt;</span>(&amp;val), [](T*){});</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    }</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    <span class="comment">// User callbacks</span></div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    <span class="comment">// Most are launched in a separate thread, for convenience, except</span></div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;    <span class="comment">// message_arrived, for performance.</span></div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    <span class="keywordtype">void</span> connected(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; cause)<span class="keyword"> override </span>{</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;        std::async(std::launch::async, &amp;<a class="code" href="classmqtt_1_1callback.html#a831d2270e3296527fce29852c2822c86">callback::connected</a>, userCallback_, cause);</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    }</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    <span class="keywordtype">void</span> connection_lost(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; cause)<span class="keyword"> override </span>{</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;        std::async(std::launch::async,</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;                   &amp;<a class="code" href="classmqtt_1_1callback.html#ad33f388261c80db6d529089a9561c69d">callback::connection_lost</a>, userCallback_, cause);</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    }</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    <span class="keywordtype">void</span> message_arrived(const_message_ptr msg)<span class="keyword"> override </span>{</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;        userCallback_-&gt;<a class="code" href="classmqtt_1_1callback.html#ae18e49acbf085b2e419d43916a5150c8">message_arrived</a>(msg);</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    }</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    <span class="keywordtype">void</span> delivery_complete(delivery_token_ptr tok)<span class="keyword"> override </span>{</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;        std::async(std::launch::async, &amp;<a class="code" href="classmqtt_1_1callback.html#a7165d51b17104475f679254d25b4ba97">callback::delivery_complete</a>, userCallback_, tok);</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;    }</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    <a class="code" href="classmqtt_1_1client.html">client</a>() =<span class="keyword">delete</span>;</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    <a class="code" href="classmqtt_1_1client.html">client</a>(<span class="keyword">const</span> <a class="code" href="classmqtt_1_1async__client.html">async_client</a>&amp;) =<span class="keyword">delete</span>;</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    <a class="code" href="classmqtt_1_1client.html">client</a>&amp; operator=(<span class="keyword">const</span> <a class="code" href="classmqtt_1_1async__client.html">async_client</a>&amp;) =<span class="keyword">delete</span>;</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a0b763b9915200415709ef87e66405d3b">   91</a></span>&#160;    <span class="keyword">using</span> <a class="code" href="classmqtt_1_1callback.html#a40562ff84237a6935d804c3bf47a6a66">ptr_t</a> = std::shared_ptr&lt;client&gt;;</div>
<div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#aab7f6333d1b4c20671a879c30139bfbd">   93</a></span>&#160;    <span class="keyword">using</span> <a class="code" href="classmqtt_1_1client.html#aab7f6333d1b4c20671a879c30139bfbd">qos_collection</a> = <a class="code" href="classmqtt_1_1iasync__client.html#aee95659bed2446d0409ce33479f9cdad">async_client::qos_collection</a>;</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;    <a class="code" href="classmqtt_1_1client.html">client</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; serverURI, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; clientId,</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;           <a class="code" href="classmqtt_1_1iclient__persistence.html">iclient_persistence</a>* persistence=<span class="keyword">nullptr</span>);</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;    <a class="code" href="classmqtt_1_1client.html">client</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; serverURI, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; clientId,</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;           <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; persistDir);</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;    <a class="code" href="classmqtt_1_1client.html">client</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; serverURI, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; clientId,</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;           <span class="keywordtype">int</span> maxBufferedMessages, <a class="code" href="classmqtt_1_1iclient__persistence.html">iclient_persistence</a>* persistence=<span class="keyword">nullptr</span>);</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;    <a class="code" href="classmqtt_1_1client.html">client</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; serverURI, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; clientId,</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;           <span class="keywordtype">int</span> maxBufferedMessages, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; persistDir);</div>
<div class="line"><a name="l00153"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#ad4c593fc1961d56a5cf4082a30a8bf45">  153</a></span>&#160;    <span class="keyword">virtual</span> <a class="code" href="classmqtt_1_1client.html#ad4c593fc1961d56a5cf4082a30a8bf45">~client</a>() {}</div>
<div class="line"><a name="l00157"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a8807675e81a186f09eba5b5f050d772c">  157</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#a8807675e81a186f09eba5b5f050d772c">connect</a>() {</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;        cli_.<a class="code" href="classmqtt_1_1async__client.html#aee06a4438b2075de021bbf8d5b6b0c33">connect</a>()-&gt;wait_for(timeout_);</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;        cli_.<a class="code" href="classmqtt_1_1async__client.html#abcdbc13e54bb4ba1e52e8e405297d170">start_consuming</a>();</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;    }</div>
<div class="line"><a name="l00165"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a19f8a6093bcf531afe09885e1f4e1de5">  165</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#a19f8a6093bcf531afe09885e1f4e1de5">connect</a>(<a class="code" href="classmqtt_1_1connect__options.html">connect_options</a> opts) {</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;        cli_.<a class="code" href="classmqtt_1_1async__client.html#aee06a4438b2075de021bbf8d5b6b0c33">connect</a>(std::move(opts))-&gt;wait_for(timeout_);</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;        cli_.<a class="code" href="classmqtt_1_1async__client.html#abcdbc13e54bb4ba1e52e8e405297d170">start_consuming</a>();</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;    }</div>
<div class="line"><a name="l00173"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a46334d438bbb3204f5b8105277edbfa1">  173</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#a46334d438bbb3204f5b8105277edbfa1">reconnect</a>() { cli_.<a class="code" href="classmqtt_1_1async__client.html#a93cad44caab9aa829745477b170eae3d">reconnect</a>()-&gt;wait_for(timeout_); }</div>
<div class="line"><a name="l00177"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a3b0035bbb0a2ecd382a32862323540f8">  177</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#a3b0035bbb0a2ecd382a32862323540f8">disconnect</a>() {</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;        cli_.<a class="code" href="classmqtt_1_1async__client.html#ab5aaa839a2832009148202fa5a81c4f2">stop_consuming</a>();</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;        cli_.<a class="code" href="classmqtt_1_1async__client.html#a376960f9e1fbe5e40136f2f07b22d780">disconnect</a>()-&gt;wait_for(timeout_);</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;    }</div>
<div class="line"><a name="l00187"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a265207cf3751aaec626b2e0adc404ec1">  187</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#a265207cf3751aaec626b2e0adc404ec1">disconnect</a>(<span class="keywordtype">int</span> timeoutMS) {</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;        cli_.<a class="code" href="classmqtt_1_1async__client.html#ab5aaa839a2832009148202fa5a81c4f2">stop_consuming</a>();</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;        cli_.<a class="code" href="classmqtt_1_1async__client.html#a376960f9e1fbe5e40136f2f07b22d780">disconnect</a>(timeoutMS)-&gt;wait_for(timeout_);</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;    }</div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">class</span> Rep, <span class="keyword">class</span> Period&gt;</div>
<div class="line"><a name="l00198"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a4aaac9fee1828a55a1473de048117995">  198</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#a4aaac9fee1828a55a1473de048117995">disconnect</a>(<span class="keyword">const</span> std::chrono::duration&lt;Rep, Period&gt;&amp; to) {</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;        <a class="code" href="classmqtt_1_1client.html#a3b0035bbb0a2ecd382a32862323540f8">disconnect</a>((<span class="keywordtype">int</span>) to_milliseconds_count(to));</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;    }</div>
<div class="line"><a name="l00205"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a2a732cd4ff04ef7e8fcaa40116df3728">  205</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">string</span> <a class="code" href="classmqtt_1_1client.html#a2a732cd4ff04ef7e8fcaa40116df3728">get_client_id</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> cli_.<a class="code" href="classmqtt_1_1async__client.html#a8105627f112a23e5c8067901cf1650a2">get_client_id</a>(); }</div>
<div class="line"><a name="l00210"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a319cb63c7d497904664f105ee0f7d8fa">  210</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">string</span> <a class="code" href="classmqtt_1_1client.html#a319cb63c7d497904664f105ee0f7d8fa">get_server_uri</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> cli_.<a class="code" href="classmqtt_1_1async__client.html#ad2cc6dc75715f467c8c0556f0f0c6c04">get_server_uri</a>(); }</div>
<div class="line"><a name="l00215"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a350673f8b468c49ea93c35535732e9dd">  215</a></span>&#160;    <span class="keyword">virtual</span> std::chrono::milliseconds <a class="code" href="classmqtt_1_1client.html#a350673f8b468c49ea93c35535732e9dd">get_timeout</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> timeout_; }</div>
<div class="line"><a name="l00222"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a382c9987d330b66c93dfe809a1f2d595">  222</a></span>&#160;    <span class="keyword">virtual</span> <a class="code" href="classmqtt_1_1topic.html">topic</a> <a class="code" href="classmqtt_1_1client.html#a382c9987d330b66c93dfe809a1f2d595">get_topic</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; top) { <span class="keywordflow">return</span> <a class="code" href="classmqtt_1_1topic.html">topic</a>(cli_, top); }</div>
<div class="line"><a name="l00228"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#af37670f9792f932e273867a31f8cb2a5">  228</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classmqtt_1_1client.html#af37670f9792f932e273867a31f8cb2a5">is_connected</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> cli_.<a class="code" href="classmqtt_1_1async__client.html#aefe2b8717b52d9b6c92f0ea8d89a3dbe">is_connected</a>(); }</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;</div>
<div class="line"><a name="l00239"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a8d189ae5704af137c20a8024d440c311">  239</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#a8d189ae5704af137c20a8024d440c311">publish</a>(<a class="code" href="classmqtt_1_1buffer__ref.html">string_ref</a> top, <span class="keyword">const</span> <span class="keywordtype">void</span>* payload, <span class="keywordtype">size_t</span> n,</div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;                         <span class="keywordtype">int</span> qos, <span class="keywordtype">bool</span> retained) {</div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;        cli_.<a class="code" href="classmqtt_1_1async__client.html#a7fa8d3dd5b88a5643dcd28e5069da8a5">publish</a>(std::move(top), payload, n, qos, retained)-&gt;wait_for(timeout_);</div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;    }</div>
<div class="line"><a name="l00250"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#ad1ecdeaba58251b1edec1f2cd7d43f5e">  250</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#ad1ecdeaba58251b1edec1f2cd7d43f5e">publish</a>(<a class="code" href="classmqtt_1_1buffer__ref.html">string_ref</a> top, <span class="keyword">const</span> <span class="keywordtype">void</span>* payload, <span class="keywordtype">size_t</span> n) {</div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;        cli_.<a class="code" href="classmqtt_1_1async__client.html#a7fa8d3dd5b88a5643dcd28e5069da8a5">publish</a>(std::move(top), payload, n)-&gt;wait_for(timeout_);</div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;    }</div>
<div class="line"><a name="l00257"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a28bba2c5b9e1bbf0b4a509624b76af45">  257</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#a28bba2c5b9e1bbf0b4a509624b76af45">publish</a>(const_message_ptr msg) {</div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;        cli_.<a class="code" href="classmqtt_1_1async__client.html#a7fa8d3dd5b88a5643dcd28e5069da8a5">publish</a>(msg)-&gt;wait_for(timeout_);</div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;    }</div>
<div class="line"><a name="l00267"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a23c58f6b35ac3842a68c3a5548db0b9d">  267</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#a23c58f6b35ac3842a68c3a5548db0b9d">publish</a>(<span class="keyword">const</span> <a class="code" href="classmqtt_1_1message.html">message</a>&amp; msg) {</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;        cli_.<a class="code" href="classmqtt_1_1async__client.html#a7fa8d3dd5b88a5643dcd28e5069da8a5">publish</a>(ptr(msg))-&gt;wait();</div>
<div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;    }</div>
<div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#a49d9d64861e7f6bf436b212e26d3ba33">set_callback</a>(<a class="code" href="classmqtt_1_1callback.html">callback</a>&amp; cb);</div>
<div class="line"><a name="l00280"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#aedb0a9a0bedf95e544a0b8a5764b56ab">  280</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#aedb0a9a0bedf95e544a0b8a5764b56ab">set_timeout</a>(<span class="keywordtype">int</span> timeoutMS) {</div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;        timeout_ = std::chrono::milliseconds(timeoutMS);</div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;    }</div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">class</span> Rep, <span class="keyword">class</span> Period&gt;</div>
<div class="line"><a name="l00288"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a74d3c7699b56ea1c7ceaf7a58910c3ca">  288</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#a74d3c7699b56ea1c7ceaf7a58910c3ca">set_timeout</a>(<span class="keyword">const</span> std::chrono::duration&lt;Rep, Period&gt;&amp; to) {</div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;        timeout_ = to_milliseconds(to);</div>
<div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;    }</div>
<div class="line"><a name="l00295"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#aba3e65033a2e5e2bd5b3235e695744f6">  295</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#aba3e65033a2e5e2bd5b3235e695744f6">subscribe</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; topicFilter) {</div>
<div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;        cli_.<a class="code" href="classmqtt_1_1async__client.html#a8b20a22af1069ef41c27566698bd90bd">subscribe</a>(topicFilter, DFLT_QOS)-&gt;wait_for(timeout_);</div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;    }</div>
<div class="line"><a name="l00303"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a0bced094f95428f53faa8450471af48c">  303</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#a0bced094f95428f53faa8450471af48c">subscribe</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; topicFilter, <span class="keywordtype">int</span> qos) {</div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;        cli_.<a class="code" href="classmqtt_1_1async__client.html#a8b20a22af1069ef41c27566698bd90bd">subscribe</a>(topicFilter, qos)-&gt;wait_for(timeout_);</div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;    }</div>
<div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#aba3e65033a2e5e2bd5b3235e695744f6">subscribe</a>(<span class="keyword">const</span> <a class="code" href="classmqtt_1_1string__collection.html">string_collection</a>&amp; topicFilters);</div>
<div class="line"><a name="l00317"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a1a75c2496bdfb2fb48208155c0fe4b46">  317</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#a1a75c2496bdfb2fb48208155c0fe4b46">subscribe</a>(<span class="keyword">const</span> <a class="code" href="classmqtt_1_1string__collection.html">string_collection</a>&amp; topicFilters,</div>
<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;                           <span class="keyword">const</span> <a class="code" href="classmqtt_1_1client.html#aab7f6333d1b4c20671a879c30139bfbd">qos_collection</a>&amp; qos) {</div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;        cli_.<a class="code" href="classmqtt_1_1async__client.html#a8b20a22af1069ef41c27566698bd90bd">subscribe</a>(ptr(topicFilters), qos)-&gt;wait_for(timeout_);</div>
<div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;    }</div>
<div class="line"><a name="l00325"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a16bd3d5e33df2082fdff22519c5a8cde">  325</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#a16bd3d5e33df2082fdff22519c5a8cde">unsubscribe</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; topicFilter) {</div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;        cli_.<a class="code" href="classmqtt_1_1async__client.html#ae709e53471db54ec614bcc9d8978361e">unsubscribe</a>(topicFilter)-&gt;wait_for(timeout_);</div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;    }</div>
<div class="line"><a name="l00332"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a72feacc13ca065ff5bf325cf90fd7c69">  332</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#a72feacc13ca065ff5bf325cf90fd7c69">unsubscribe</a>(<span class="keyword">const</span> <a class="code" href="classmqtt_1_1string__collection.html">string_collection</a>&amp; topicFilters) {</div>
<div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;        cli_.<a class="code" href="classmqtt_1_1async__client.html#ae709e53471db54ec614bcc9d8978361e">unsubscribe</a>(ptr(topicFilters))-&gt;wait_for(timeout_);</div>
<div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;    }</div>
<div class="line"><a name="l00340"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a7e5ca8022931233cc3d70966d96e668f">  340</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#a7e5ca8022931233cc3d70966d96e668f">start_consuming</a>() { cli_.<a class="code" href="classmqtt_1_1async__client.html#abcdbc13e54bb4ba1e52e8e405297d170">start_consuming</a>(); }</div>
<div class="line"><a name="l00346"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a16e06de5406920137ce2911484ab8fd5">  346</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classmqtt_1_1client.html#a16e06de5406920137ce2911484ab8fd5">stop_consuming</a>() { cli_.<a class="code" href="classmqtt_1_1async__client.html#ab5aaa839a2832009148202fa5a81c4f2">stop_consuming</a>(); }</div>
<div class="line"><a name="l00352"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#ae0eb28b9ffe328425033726de53495b6">  352</a></span>&#160;    const_message_ptr <a class="code" href="classmqtt_1_1client.html#ae0eb28b9ffe328425033726de53495b6">consume_message</a>() { <span class="keywordflow">return</span> cli_.<a class="code" href="classmqtt_1_1async__client.html#a479e2e058c190b575f75a17cdc08299b">consume_message</a>(); }</div>
<div class="line"><a name="l00359"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a4d759105cc3f9cb15824a37d4f8a39f4">  359</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classmqtt_1_1client.html#a4d759105cc3f9cb15824a37d4f8a39f4">try_consume_message</a>(const_message_ptr* msg) {</div>
<div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160;        <span class="keywordflow">return</span> cli_.<a class="code" href="classmqtt_1_1async__client.html#a9260ee858860df9d39dd570cc15f56a1">try_consume_message</a>(msg);</div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;    }</div>
<div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Rep, <span class="keyword">class</span> Period&gt;</div>
<div class="line"><a name="l00370"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a4801f2305d62d1213a8914556319ddb6">  370</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classmqtt_1_1client.html#a4801f2305d62d1213a8914556319ddb6">try_consume_message_for</a>(const_message_ptr* msg,</div>
<div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160;                                 <span class="keyword">const</span> std::chrono::duration&lt;Rep, Period&gt;&amp; relTime) {</div>
<div class="line"><a name="l00372"></a><span class="lineno">  372</span>&#160;        <span class="keywordflow">return</span> cli_.<a class="code" href="classmqtt_1_1async__client.html#a5613bf9226d6ad9b8dcf15a238c18c23">try_consume_message_for</a>(msg, relTime);</div>
<div class="line"><a name="l00373"></a><span class="lineno">  373</span>&#160;    }</div>
<div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">class</span> Clock, <span class="keyword">class</span> Duration&gt;</div>
<div class="line"><a name="l00382"></a><span class="lineno"><a class="line" href="classmqtt_1_1client.html#a1a98495d611332f8095f895168891181">  382</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classmqtt_1_1client.html#a1a98495d611332f8095f895168891181">try_consume_message_until</a>(const_message_ptr* msg,</div>
<div class="line"><a name="l00383"></a><span class="lineno">  383</span>&#160;                                   <span class="keyword">const</span> std::chrono::time_point&lt;Clock,Duration&gt;&amp; absTime) {</div>
<div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160;        <span class="keywordflow">return</span> cli_.<a class="code" href="classmqtt_1_1async__client.html#a8bc99d5afd5d35aeb0888ff6c08b9ed0">try_consume_message_until</a>(msg, absTime);</div>
<div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160;    }</div>
<div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;};</div>
<div class="line"><a name="l00387"></a><span class="lineno">  387</span>&#160;</div>
<div class="line"><a name="l00389"></a><span class="lineno">  389</span>&#160;<span class="keyword">using</span> client_ptr = <a class="code" href="classmqtt_1_1client.html#a0b763b9915200415709ef87e66405d3b">client::ptr_t</a>;</div>
<div class="line"><a name="l00390"></a><span class="lineno">  390</span>&#160;</div>
<div class="line"><a name="l00392"></a><span class="lineno">  392</span>&#160;<span class="comment">// end namespace mqtt</span></div>
<div class="line"><a name="l00393"></a><span class="lineno">  393</span>&#160;}</div>
<div class="line"><a name="l00394"></a><span class="lineno">  394</span>&#160;</div>
<div class="line"><a name="l00395"></a><span class="lineno">  395</span>&#160;<span class="preprocessor">#endif      // __mqtt_client_h</span></div>
<div class="line"><a name="l00396"></a><span class="lineno">  396</span>&#160;<span class="preprocessor"></span></div>
<div class="ttc" id="classmqtt_1_1callback_html_a40562ff84237a6935d804c3bf47a6a66"><div class="ttname"><a href="classmqtt_1_1callback.html#a40562ff84237a6935d804c3bf47a6a66">mqtt::callback::ptr_t</a></div><div class="ttdeci">std::shared_ptr&lt; callback &gt; ptr_t</div><div class="ttdoc">Smart/shared pointer to an object of this type. </div><div class="ttdef"><b>Definition:</b> callback.h:45</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a16bd3d5e33df2082fdff22519c5a8cde"><div class="ttname"><a href="classmqtt_1_1client.html#a16bd3d5e33df2082fdff22519c5a8cde">mqtt::client::unsubscribe</a></div><div class="ttdeci">virtual void unsubscribe(const string &amp;topicFilter)</div><div class="ttdoc">Requests the server unsubscribe the client from a topic. </div><div class="ttdef"><b>Definition:</b> client.h:325</div></div>
<div class="ttc" id="classmqtt_1_1async__client_html"><div class="ttname"><a href="classmqtt_1_1async__client.html">mqtt::async_client</a></div><div class="ttdoc">Lightweight client for talking to an MQTT server using non-blocking methods that allow an operation t...</div><div class="ttdef"><b>Definition:</b> async_client.h:60</div></div>
<div class="ttc" id="classmqtt_1_1iclient__persistence_html"><div class="ttname"><a href="classmqtt_1_1iclient__persistence.html">mqtt::iclient_persistence</a></div><div class="ttdoc">Represents a persistent data store, used to store outbound and inbound messages while they are in fli...</div><div class="ttdef"><b>Definition:</b> iclient_persistence.h:54</div></div>
<div class="ttc" id="classmqtt_1_1async__client_html_ad2cc6dc75715f467c8c0556f0f0c6c04"><div class="ttname"><a href="classmqtt_1_1async__client.html#ad2cc6dc75715f467c8c0556f0f0c6c04">mqtt::async_client::get_server_uri</a></div><div class="ttdeci">string get_server_uri() const override</div><div class="ttdoc">Returns the address of the server used by this client. </div><div class="ttdef"><b>Definition:</b> async_client.h:339</div></div>
<div class="ttc" id="classmqtt_1_1async__client_html_a93cad44caab9aa829745477b170eae3d"><div class="ttname"><a href="classmqtt_1_1async__client.html#a93cad44caab9aa829745477b170eae3d">mqtt::async_client::reconnect</a></div><div class="ttdeci">token_ptr reconnect() override</div><div class="ttdoc">Reconnects the client using options from the previous connect. </div></div>
<div class="ttc" id="classmqtt_1_1async__client_html_a479e2e058c190b575f75a17cdc08299b"><div class="ttname"><a href="classmqtt_1_1async__client.html#a479e2e058c190b575f75a17cdc08299b">mqtt::async_client::consume_message</a></div><div class="ttdeci">const_message_ptr consume_message()</div><div class="ttdoc">Read the next message from the queue. </div><div class="ttdef"><b>Definition:</b> async_client.h:566</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a4801f2305d62d1213a8914556319ddb6"><div class="ttname"><a href="classmqtt_1_1client.html#a4801f2305d62d1213a8914556319ddb6">mqtt::client::try_consume_message_for</a></div><div class="ttdeci">bool try_consume_message_for(const_message_ptr *msg, const std::chrono::duration&lt; Rep, Period &gt; &amp;relTime)</div><div class="ttdoc">Waits a limited time for a message to arrive. </div><div class="ttdef"><b>Definition:</b> client.h:370</div></div>
<div class="ttc" id="classmqtt_1_1client_html_ad4c593fc1961d56a5cf4082a30a8bf45"><div class="ttname"><a href="classmqtt_1_1client.html#ad4c593fc1961d56a5cf4082a30a8bf45">mqtt::client::~client</a></div><div class="ttdeci">virtual ~client()</div><div class="ttdoc">Virtual destructor. </div><div class="ttdef"><b>Definition:</b> client.h:153</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a382c9987d330b66c93dfe809a1f2d595"><div class="ttname"><a href="classmqtt_1_1client.html#a382c9987d330b66c93dfe809a1f2d595">mqtt::client::get_topic</a></div><div class="ttdeci">virtual topic get_topic(const string &amp;top)</div><div class="ttdoc">Get a topic object which can be used to publish messages on this client. </div><div class="ttdef"><b>Definition:</b> client.h:222</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a19f8a6093bcf531afe09885e1f4e1de5"><div class="ttname"><a href="classmqtt_1_1client.html#a19f8a6093bcf531afe09885e1f4e1de5">mqtt::client::connect</a></div><div class="ttdeci">virtual void connect(connect_options opts)</div><div class="ttdoc">Connects to an MQTT server using the specified options. </div><div class="ttdef"><b>Definition:</b> client.h:165</div></div>
<div class="ttc" id="classmqtt_1_1callback_html_ad33f388261c80db6d529089a9561c69d"><div class="ttname"><a href="classmqtt_1_1callback.html#ad33f388261c80db6d529089a9561c69d">mqtt::callback::connection_lost</a></div><div class="ttdeci">virtual void connection_lost(const string &amp;cause)</div><div class="ttdoc">This method is called when the connection to the server is lost. </div><div class="ttdef"><b>Definition:</b> callback.h:63</div></div>
<div class="ttc" id="classmqtt_1_1async__client_html_aefe2b8717b52d9b6c92f0ea8d89a3dbe"><div class="ttname"><a href="classmqtt_1_1async__client.html#aefe2b8717b52d9b6c92f0ea8d89a3dbe">mqtt::async_client::is_connected</a></div><div class="ttdeci">bool is_connected() const override</div><div class="ttdoc">Determines if this client is currently connected to the server. </div><div class="ttdef"><b>Definition:</b> async_client.h:344</div></div>
<div class="ttc" id="classmqtt_1_1async__client_html_aee06a4438b2075de021bbf8d5b6b0c33"><div class="ttname"><a href="classmqtt_1_1async__client.html#aee06a4438b2075de021bbf8d5b6b0c33">mqtt::async_client::connect</a></div><div class="ttdeci">token_ptr connect() override</div><div class="ttdoc">Connects to an MQTT server using the default options. </div></div>
<div class="ttc" id="classmqtt_1_1client_html_a1a98495d611332f8095f895168891181"><div class="ttname"><a href="classmqtt_1_1client.html#a1a98495d611332f8095f895168891181">mqtt::client::try_consume_message_until</a></div><div class="ttdeci">bool try_consume_message_until(const_message_ptr *msg, const std::chrono::time_point&lt; Clock, Duration &gt; &amp;absTime)</div><div class="ttdoc">Waits until a specific time for a message to occur. </div><div class="ttdef"><b>Definition:</b> client.h:382</div></div>
<div class="ttc" id="classmqtt_1_1connect__options_html"><div class="ttname"><a href="classmqtt_1_1connect__options.html">mqtt::connect_options</a></div><div class="ttdoc">Holds the set of options that control how the client connects to a server. </div><div class="ttdef"><b>Definition:</b> connect_options.h:46</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a350673f8b468c49ea93c35535732e9dd"><div class="ttname"><a href="classmqtt_1_1client.html#a350673f8b468c49ea93c35535732e9dd">mqtt::client::get_timeout</a></div><div class="ttdeci">virtual std::chrono::milliseconds get_timeout() const </div><div class="ttdoc">Return the maximum time to wait for an action to complete. </div><div class="ttdef"><b>Definition:</b> client.h:215</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a1a75c2496bdfb2fb48208155c0fe4b46"><div class="ttname"><a href="classmqtt_1_1client.html#a1a75c2496bdfb2fb48208155c0fe4b46">mqtt::client::subscribe</a></div><div class="ttdeci">virtual void subscribe(const string_collection &amp;topicFilters, const qos_collection &amp;qos)</div><div class="ttdoc">Subscribes to multiple topics, each of which may include wildcards. </div><div class="ttdef"><b>Definition:</b> client.h:317</div></div>
<div class="ttc" id="classmqtt_1_1topic_html"><div class="ttname"><a href="classmqtt_1_1topic.html">mqtt::topic</a></div><div class="ttdoc">Represents a topic destination, used for publish/subscribe messaging. </div><div class="ttdef"><b>Definition:</b> topic.h:42</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a49d9d64861e7f6bf436b212e26d3ba33"><div class="ttname"><a href="classmqtt_1_1client.html#a49d9d64861e7f6bf436b212e26d3ba33">mqtt::client::set_callback</a></div><div class="ttdeci">virtual void set_callback(callback &amp;cb)</div><div class="ttdoc">Sets the callback listener to use for events that happen asynchronously. </div></div>
<div class="ttc" id="classmqtt_1_1buffer__ref_html"><div class="ttname"><a href="classmqtt_1_1buffer__ref.html">mqtt::buffer_ref&lt; char &gt;</a></div></div>
<div class="ttc" id="classmqtt_1_1client_html_a8d189ae5704af137c20a8024d440c311"><div class="ttname"><a href="classmqtt_1_1client.html#a8d189ae5704af137c20a8024d440c311">mqtt::client::publish</a></div><div class="ttdeci">virtual void publish(string_ref top, const void *payload, size_t n, int qos, bool retained)</div><div class="ttdoc">Publishes a message to a topic on the server and return once it is delivered. </div><div class="ttdef"><b>Definition:</b> client.h:239</div></div>
<div class="ttc" id="classmqtt_1_1callback_html_a831d2270e3296527fce29852c2822c86"><div class="ttname"><a href="classmqtt_1_1callback.html#a831d2270e3296527fce29852c2822c86">mqtt::callback::connected</a></div><div class="ttdeci">virtual void connected(const string &amp;cause)</div><div class="ttdoc">This method is called when the client is connected. </div><div class="ttdef"><b>Definition:</b> callback.h:58</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a23c58f6b35ac3842a68c3a5548db0b9d"><div class="ttname"><a href="classmqtt_1_1client.html#a23c58f6b35ac3842a68c3a5548db0b9d">mqtt::client::publish</a></div><div class="ttdeci">virtual void publish(const message &amp;msg)</div><div class="ttdoc">Publishes a message to a topic on the server. </div><div class="ttdef"><b>Definition:</b> client.h:267</div></div>
<div class="ttc" id="classmqtt_1_1client_html_af37670f9792f932e273867a31f8cb2a5"><div class="ttname"><a href="classmqtt_1_1client.html#af37670f9792f932e273867a31f8cb2a5">mqtt::client::is_connected</a></div><div class="ttdeci">virtual bool is_connected() const </div><div class="ttdoc">Determines if this client is currently connected to the server. </div><div class="ttdef"><b>Definition:</b> client.h:228</div></div>
<div class="ttc" id="classmqtt_1_1async__client_html_abcdbc13e54bb4ba1e52e8e405297d170"><div class="ttname"><a href="classmqtt_1_1async__client.html#abcdbc13e54bb4ba1e52e8e405297d170">mqtt::async_client::start_consuming</a></div><div class="ttdeci">void start_consuming()</div><div class="ttdoc">Start consuming messages. </div></div>
<div class="ttc" id="classmqtt_1_1string__collection_html"><div class="ttname"><a href="classmqtt_1_1string__collection.html">mqtt::string_collection</a></div><div class="ttdoc">Type for a collection of topics. </div><div class="ttdef"><b>Definition:</b> string_collection.h:40</div></div>
<div class="ttc" id="classmqtt_1_1client_html_ad1ecdeaba58251b1edec1f2cd7d43f5e"><div class="ttname"><a href="classmqtt_1_1client.html#ad1ecdeaba58251b1edec1f2cd7d43f5e">mqtt::client::publish</a></div><div class="ttdeci">virtual void publish(string_ref top, const void *payload, size_t n)</div><div class="ttdoc">Publishes a message to a topic on the server and return once it is delivered. </div><div class="ttdef"><b>Definition:</b> client.h:250</div></div>
<div class="ttc" id="async__client_8h_html"><div class="ttname"><a href="async__client_8h.html">async_client.h</a></div><div class="ttdoc">Declaration of MQTT async_client class. </div></div>
<div class="ttc" id="classmqtt_1_1async__client_html_a7fa8d3dd5b88a5643dcd28e5069da8a5"><div class="ttname"><a href="classmqtt_1_1async__client.html#a7fa8d3dd5b88a5643dcd28e5069da8a5">mqtt::async_client::publish</a></div><div class="ttdeci">delivery_token_ptr publish(string_ref topic, const void *payload, size_t n, int qos, bool retained) override</div><div class="ttdoc">Publishes a message to a topic on the server. </div></div>
<div class="ttc" id="classmqtt_1_1client_html_a46334d438bbb3204f5b8105277edbfa1"><div class="ttname"><a href="classmqtt_1_1client.html#a46334d438bbb3204f5b8105277edbfa1">mqtt::client::reconnect</a></div><div class="ttdeci">virtual void reconnect()</div><div class="ttdoc">Reconnects the client using options from the previous connect. </div><div class="ttdef"><b>Definition:</b> client.h:173</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a16e06de5406920137ce2911484ab8fd5"><div class="ttname"><a href="classmqtt_1_1client.html#a16e06de5406920137ce2911484ab8fd5">mqtt::client::stop_consuming</a></div><div class="ttdeci">void stop_consuming()</div><div class="ttdoc">Stop consuming messages. </div><div class="ttdef"><b>Definition:</b> client.h:346</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a4aaac9fee1828a55a1473de048117995"><div class="ttname"><a href="classmqtt_1_1client.html#a4aaac9fee1828a55a1473de048117995">mqtt::client::disconnect</a></div><div class="ttdeci">void disconnect(const std::chrono::duration&lt; Rep, Period &gt; &amp;to)</div><div class="ttdoc">Disconnects from the server. </div><div class="ttdef"><b>Definition:</b> client.h:198</div></div>
<div class="ttc" id="classmqtt_1_1async__client_html_a9260ee858860df9d39dd570cc15f56a1"><div class="ttname"><a href="classmqtt_1_1async__client.html#a9260ee858860df9d39dd570cc15f56a1">mqtt::async_client::try_consume_message</a></div><div class="ttdeci">bool try_consume_message(const_message_ptr *msg)</div><div class="ttdoc">Try to read the next message from the queue without blocking. </div><div class="ttdef"><b>Definition:</b> async_client.h:573</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a28bba2c5b9e1bbf0b4a509624b76af45"><div class="ttname"><a href="classmqtt_1_1client.html#a28bba2c5b9e1bbf0b4a509624b76af45">mqtt::client::publish</a></div><div class="ttdeci">virtual void publish(const_message_ptr msg)</div><div class="ttdoc">Publishes a message to a topic on the server. </div><div class="ttdef"><b>Definition:</b> client.h:257</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a3b0035bbb0a2ecd382a32862323540f8"><div class="ttname"><a href="classmqtt_1_1client.html#a3b0035bbb0a2ecd382a32862323540f8">mqtt::client::disconnect</a></div><div class="ttdeci">virtual void disconnect()</div><div class="ttdoc">Disconnects from the server. </div><div class="ttdef"><b>Definition:</b> client.h:177</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a0bced094f95428f53faa8450471af48c"><div class="ttname"><a href="classmqtt_1_1client.html#a0bced094f95428f53faa8450471af48c">mqtt::client::subscribe</a></div><div class="ttdeci">virtual void subscribe(const string &amp;topicFilter, int qos)</div><div class="ttdoc">Subscribe to a topic, which may include wildcards. </div><div class="ttdef"><b>Definition:</b> client.h:303</div></div>
<div class="ttc" id="classmqtt_1_1async__client_html_a5613bf9226d6ad9b8dcf15a238c18c23"><div class="ttname"><a href="classmqtt_1_1async__client.html#a5613bf9226d6ad9b8dcf15a238c18c23">mqtt::async_client::try_consume_message_for</a></div><div class="ttdeci">bool try_consume_message_for(const_message_ptr *msg, const std::chrono::duration&lt; Rep, Period &gt; &amp;relTime)</div><div class="ttdoc">Waits a limited time for a message to arrive. </div><div class="ttdef"><b>Definition:</b> async_client.h:584</div></div>
<div class="ttc" id="classmqtt_1_1client_html_aab7f6333d1b4c20671a879c30139bfbd"><div class="ttname"><a href="classmqtt_1_1client.html#aab7f6333d1b4c20671a879c30139bfbd">mqtt::client::qos_collection</a></div><div class="ttdeci">async_client::qos_collection qos_collection</div><div class="ttdoc">Type for a collection of QOS values. </div><div class="ttdef"><b>Definition:</b> client.h:93</div></div>
<div class="ttc" id="classmqtt_1_1message_html"><div class="ttname"><a href="classmqtt_1_1message.html">mqtt::message</a></div><div class="ttdoc">An MQTT message holds everything required for an MQTT PUBLISH message. </div><div class="ttdef"><b>Definition:</b> message.h:52</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a74d3c7699b56ea1c7ceaf7a58910c3ca"><div class="ttname"><a href="classmqtt_1_1client.html#a74d3c7699b56ea1c7ceaf7a58910c3ca">mqtt::client::set_timeout</a></div><div class="ttdeci">void set_timeout(const std::chrono::duration&lt; Rep, Period &gt; &amp;to)</div><div class="ttdoc">Set the maximum time to wait for an action to complete. </div><div class="ttdef"><b>Definition:</b> client.h:288</div></div>
<div class="ttc" id="classmqtt_1_1async__client_html_ab5aaa839a2832009148202fa5a81c4f2"><div class="ttname"><a href="classmqtt_1_1async__client.html#ab5aaa839a2832009148202fa5a81c4f2">mqtt::async_client::stop_consuming</a></div><div class="ttdeci">void stop_consuming()</div><div class="ttdoc">Stop consuming messages. </div></div>
<div class="ttc" id="classmqtt_1_1callback_html_a7165d51b17104475f679254d25b4ba97"><div class="ttname"><a href="classmqtt_1_1callback.html#a7165d51b17104475f679254d25b4ba97">mqtt::callback::delivery_complete</a></div><div class="ttdeci">virtual void delivery_complete(delivery_token_ptr tok)</div><div class="ttdoc">Called when delivery for a message has been completed, and all acknowledgments have been received...</div><div class="ttdef"><b>Definition:</b> callback.h:74</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a0b763b9915200415709ef87e66405d3b"><div class="ttname"><a href="classmqtt_1_1client.html#a0b763b9915200415709ef87e66405d3b">mqtt::client::ptr_t</a></div><div class="ttdeci">std::shared_ptr&lt; client &gt; ptr_t</div><div class="ttdoc">Smart pointer type for this object. </div><div class="ttdef"><b>Definition:</b> client.h:91</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a265207cf3751aaec626b2e0adc404ec1"><div class="ttname"><a href="classmqtt_1_1client.html#a265207cf3751aaec626b2e0adc404ec1">mqtt::client::disconnect</a></div><div class="ttdeci">virtual void disconnect(int timeoutMS)</div><div class="ttdoc">Disconnects from the server. </div><div class="ttdef"><b>Definition:</b> client.h:187</div></div>
<div class="ttc" id="classmqtt_1_1async__client_html_a8b20a22af1069ef41c27566698bd90bd"><div class="ttname"><a href="classmqtt_1_1async__client.html#a8b20a22af1069ef41c27566698bd90bd">mqtt::async_client::subscribe</a></div><div class="ttdeci">token_ptr subscribe(const_string_collection_ptr topicFilters, const qos_collection &amp;qos) override</div><div class="ttdoc">Subscribe to multiple topics, each of which may include wildcards. </div></div>
<div class="ttc" id="classmqtt_1_1client_html"><div class="ttname"><a href="classmqtt_1_1client.html">mqtt::client</a></div><div class="ttdoc">Lightweight client for talking to an MQTT server using methods that block until an operation complete...</div><div class="ttdef"><b>Definition:</b> client.h:38</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a4d759105cc3f9cb15824a37d4f8a39f4"><div class="ttname"><a href="classmqtt_1_1client.html#a4d759105cc3f9cb15824a37d4f8a39f4">mqtt::client::try_consume_message</a></div><div class="ttdeci">bool try_consume_message(const_message_ptr *msg)</div><div class="ttdoc">Try to read the next message from the queue without blocking. </div><div class="ttdef"><b>Definition:</b> client.h:359</div></div>
<div class="ttc" id="classmqtt_1_1client_html_aedb0a9a0bedf95e544a0b8a5764b56ab"><div class="ttname"><a href="classmqtt_1_1client.html#aedb0a9a0bedf95e544a0b8a5764b56ab">mqtt::client::set_timeout</a></div><div class="ttdeci">virtual void set_timeout(int timeoutMS)</div><div class="ttdoc">Set the maximum time to wait for an action to complete. </div><div class="ttdef"><b>Definition:</b> client.h:280</div></div>
<div class="ttc" id="classmqtt_1_1callback_html"><div class="ttname"><a href="classmqtt_1_1callback.html">mqtt::callback</a></div><div class="ttdoc">Provides a mechanism for tracking the completion of an asynchronous action. </div><div class="ttdef"><b>Definition:</b> callback.h:41</div></div>
<div class="ttc" id="classmqtt_1_1async__client_html_ae709e53471db54ec614bcc9d8978361e"><div class="ttname"><a href="classmqtt_1_1async__client.html#ae709e53471db54ec614bcc9d8978361e">mqtt::async_client::unsubscribe</a></div><div class="ttdeci">token_ptr unsubscribe(const string &amp;topicFilter) override</div><div class="ttdoc">Requests the server unsubscribe the client from a topic. </div></div>
<div class="ttc" id="classmqtt_1_1client_html_a319cb63c7d497904664f105ee0f7d8fa"><div class="ttname"><a href="classmqtt_1_1client.html#a319cb63c7d497904664f105ee0f7d8fa">mqtt::client::get_server_uri</a></div><div class="ttdeci">virtual string get_server_uri() const </div><div class="ttdoc">Gets the address of the server used by this client. </div><div class="ttdef"><b>Definition:</b> client.h:210</div></div>
<div class="ttc" id="classmqtt_1_1async__client_html_a8bc99d5afd5d35aeb0888ff6c08b9ed0"><div class="ttname"><a href="classmqtt_1_1async__client.html#a8bc99d5afd5d35aeb0888ff6c08b9ed0">mqtt::async_client::try_consume_message_until</a></div><div class="ttdeci">bool try_consume_message_until(const_message_ptr *msg, const std::chrono::time_point&lt; Clock, Duration &gt; &amp;absTime)</div><div class="ttdoc">Waits until a specific time for a message to occur. </div><div class="ttdef"><b>Definition:</b> async_client.h:596</div></div>
<div class="ttc" id="classmqtt_1_1async__client_html_a8105627f112a23e5c8067901cf1650a2"><div class="ttname"><a href="classmqtt_1_1async__client.html#a8105627f112a23e5c8067901cf1650a2">mqtt::async_client::get_client_id</a></div><div class="ttdeci">string get_client_id() const override</div><div class="ttdoc">Returns the client ID used by this client. </div><div class="ttdef"><b>Definition:</b> async_client.h:334</div></div>
<div class="ttc" id="classmqtt_1_1client_html_ae0eb28b9ffe328425033726de53495b6"><div class="ttname"><a href="classmqtt_1_1client.html#ae0eb28b9ffe328425033726de53495b6">mqtt::client::consume_message</a></div><div class="ttdeci">const_message_ptr consume_message()</div><div class="ttdoc">Read the next message from the queue. </div><div class="ttdef"><b>Definition:</b> client.h:352</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a8807675e81a186f09eba5b5f050d772c"><div class="ttname"><a href="classmqtt_1_1client.html#a8807675e81a186f09eba5b5f050d772c">mqtt::client::connect</a></div><div class="ttdeci">virtual void connect()</div><div class="ttdoc">Connects to an MQTT server using the default options. </div><div class="ttdef"><b>Definition:</b> client.h:157</div></div>
<div class="ttc" id="classmqtt_1_1iasync__client_html_aee95659bed2446d0409ce33479f9cdad"><div class="ttname"><a href="classmqtt_1_1iasync__client.html#aee95659bed2446d0409ce33479f9cdad">mqtt::iasync_client::qos_collection</a></div><div class="ttdeci">std::vector&lt; int &gt; qos_collection</div><div class="ttdoc">Type for a collection of QOS values. </div><div class="ttdef"><b>Definition:</b> iasync_client.h:64</div></div>
<div class="ttc" id="classmqtt_1_1async__client_html_a376960f9e1fbe5e40136f2f07b22d780"><div class="ttname"><a href="classmqtt_1_1async__client.html#a376960f9e1fbe5e40136f2f07b22d780">mqtt::async_client::disconnect</a></div><div class="ttdeci">token_ptr disconnect() override</div><div class="ttdoc">Disconnects from the server. </div><div class="ttdef"><b>Definition:</b> async_client.h:235</div></div>
<div class="ttc" id="classmqtt_1_1client_html_aba3e65033a2e5e2bd5b3235e695744f6"><div class="ttname"><a href="classmqtt_1_1client.html#aba3e65033a2e5e2bd5b3235e695744f6">mqtt::client::subscribe</a></div><div class="ttdeci">virtual void subscribe(const string &amp;topicFilter)</div><div class="ttdoc">Subscribe to a topic, which may include wildcards using a QoS of 1. </div><div class="ttdef"><b>Definition:</b> client.h:295</div></div>
<div class="ttc" id="classmqtt_1_1callback_html_ae18e49acbf085b2e419d43916a5150c8"><div class="ttname"><a href="classmqtt_1_1callback.html#ae18e49acbf085b2e419d43916a5150c8">mqtt::callback::message_arrived</a></div><div class="ttdeci">virtual void message_arrived(const_message_ptr msg)</div><div class="ttdoc">This method is called when a message arrives from the server. </div><div class="ttdef"><b>Definition:</b> callback.h:68</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a72feacc13ca065ff5bf325cf90fd7c69"><div class="ttname"><a href="classmqtt_1_1client.html#a72feacc13ca065ff5bf325cf90fd7c69">mqtt::client::unsubscribe</a></div><div class="ttdeci">virtual void unsubscribe(const string_collection &amp;topicFilters)</div><div class="ttdoc">Requests the server unsubscribe the client from one or more topics. </div><div class="ttdef"><b>Definition:</b> client.h:332</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a7e5ca8022931233cc3d70966d96e668f"><div class="ttname"><a href="classmqtt_1_1client.html#a7e5ca8022931233cc3d70966d96e668f">mqtt::client::start_consuming</a></div><div class="ttdeci">void start_consuming()</div><div class="ttdoc">Start consuming messages. </div><div class="ttdef"><b>Definition:</b> client.h:340</div></div>
<div class="ttc" id="classmqtt_1_1client_html_a2a732cd4ff04ef7e8fcaa40116df3728"><div class="ttname"><a href="classmqtt_1_1client.html#a2a732cd4ff04ef7e8fcaa40116df3728">mqtt::client::get_client_id</a></div><div class="ttdeci">virtual string get_client_id() const </div><div class="ttdoc">Gets the client ID used by this client. </div><div class="ttdef"><b>Definition:</b> client.h:205</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_503ebd9f384f44c9859dcb1451d026bc.html">mqtt</a></li><li class="navelem"><a class="el" href="client_8h.html">client.h</a></li>
    <li class="footer">Generated on Sun Jul 23 2017 10:24:29 for Paho C++ by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
  </ul>
</div>
</body>
</html>
